package com.zr.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zr.service.LZSQServiceWW;
import com.zr.serviceImpl.LZSQServiceImplWW;

public class LZSQControllerWW extends HttpServlet{

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		LZSQServiceWW lzsq = new LZSQServiceImplWW();
		HttpSession session = req.getSession();
		req.setCharacterEncoding("UTF-8");
		resp.setCharacterEncoding("UTF-8");
		int eid =Integer.parseInt((String) session.getAttribute("eid")) ;		

		String date = req.getParameter("date");		
		
		String reason = req.getParameter("MSG");	
		String ltime = req.getParameter("ltime");	
		boolean flag =	lzsq.resignApplication(date, reason, ltime, eid);
		PrintWriter pw = resp.getWriter();
		if(flag==true){
			pw.write("1");
		}else{
			pw.write("0");
		}	
		pw.flush();
		pw.close();	
	}
}
